# FROM golang:1.15-buster as builder

# COPY . /src

# ENV GO111MODULE "on"
# #ENV GOPROXY "https://goproxy.cn,direct"

# WORKDIR /src

# RUN go build -o "/fileServer" /src/*.go \
# && chmod +x /fileServer /src/entrypoint.sh




# FROM debian:buster


# COPY --from=builder /fileServer /fileServer
# COPY --from=builder /src/entrypoint.sh /entrypoint.sh

# VOLUME ["/data"]
# EXPOSE 8080

# ENTRYPOINT ["/entrypoint.sh"]

# ########

FROM debian:buster as builder

ARG TARGETPLATFORM
ARG BUILDPLATFORM

RUN mkdir /build
COPY ./ /build

RUN echo "builder TARGETPLATFORM=$TARGETPLATFORM" \
    && ls -alF / \
    && ls -alF /build

RUN bash /build/copy.sh
RUN chmod +x /build/*/*.sh

RUN echo "--------------------"



FROM debian:buster

COPY --from=builder /build/file_server  /file_server
COPY --from=builder /build/statics/ /


VOLUME ["/data"]
EXPOSE 8080

ENTRYPOINT ["/entrypoint.sh"]

